#include <iostream>
using namespace std;
int t, a, b, c, d;
char fh[3] = {'+', '-', '*'};
int text(int i, int j, int k){
	int ans;
	switch(i){
		case 0:
			switch(j){
				case 0:
					switch(k){
						case 0:
							ans = a + b + c + d;
							break;
						case 1:
							ans = a + b + c - d;
							break;
						case 2:
							ans = a + b + c * d;
							break;			
					}
					break;
				case 1:
					switch(k){
						case 0:
							ans = a + b - c + d;
							break;
						case 1:
							ans = a + b - c - d;
							break;
						case 2:
							ans = a + b - c * d;
							break;			
					}
					break;
				case 2:
					switch(k){
						case 0:
							ans = a + b * c + d;
							break;
						case 1:
							ans = a + b * c - d;
							break;
						case 2:
							ans = a + b * c * d;
							break;			
					}
					break;			
			}
			break;
		case 1:
			switch(j){
				case 0:
					switch(k){
						case 0:
							ans = a - b + c + d;
							break;
						case 1:
							ans = a - b + c - d;
							break;
						case 2:
							ans = a - b + c * d;
							break;			
					}
					break;
				case 1:
					switch(k){
						case 0:
							ans = a - b - c + d;
							break;
						case 1:
							ans = a - b - c - d;
							break;
						case 2:
							ans = a - b - c * d;
							break;			
					}
					break;
				case 2:
					switch(k){
						case 0:
							ans = a - b * c + d;
							break;
						case 1:
							ans = a - b * c - d;
							break;
						case 2:
							ans = a - b * c * d;
							break;			
					}
					break;			
			}
			break;
		case 2:
			switch(j){
				case 0:
					switch(k){
						case 0:
							ans = a * b + c + d;
							break;
						case 1:
							ans = a * b + c - d;
							break;
						case 2:
							ans = a * b + c * d;
							break;			
					}
					break;
				case 1:
					switch(k){
						case 0:
							ans = a * b - c + d;
							break;
						case 1:
							ans = a * b - c - d;
							break;
						case 2:
							ans = a * b - c * d;
							break;			
					}
					break;
				case 2:
					switch(k){
						case 0:
							ans = a * b * c + d;
							break;
						case 1:
							ans = a * b * c - d;
							break;
						case 2:
							ans = a * b * c * d;
							break;			
					}
					break;			
			}
			break;			
	}
}
int main(){
	cin >> t;
	while(t--){
		cin >> a >> b >> c >> d;
		int flag = 1;
		for (int i = 0; i < 3 && flag; i++){
			for (int j = 0; j < 3 && flag; j++){
				for (int k = 0; k < 3 && flag; k++){
					int ans = text(i, j, k);
					if (ans == 24){
						cout << a << fh[i] << b << fh[j] << c <<fh[k] << d << endl;
						flag = 0;
					}
				}
			}
		}
		if (flag) cout << -1 << endl;
	}

    return 0;
}


